package com.example.suntest.utils;

import org.apache.commons.beanutils.BeanUtilsBean;

import java.lang.reflect.InvocationTargetException;

/**
 * @version 1.0
 * @Package: com.at.mrp.bll.util
 * @ClassName: CustomBeanUtils
 * @Author: sgq
 * @Date: 2024/12/4 18:35
 * @Description: TODD
 */
public class CustomBeanUtils {
    private static final BeanUtilsBean beanUtilsBean = new BeanUtilsBean() {
        @Override
        public void copyProperty(Object dest, String name, Object value) throws IllegalAccessException, InvocationTargetException {
            if (value == null) {
                return;
            }
            super.copyProperty(dest, name, value);
        }
    };

    public static void copyProperties(Object dest, Object orig) throws IllegalAccessException, InvocationTargetException {
        beanUtilsBean.copyProperties(dest, orig);
    }
}
